home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / newsgroups / misc.20020314-20021006 / 000025_msapiro@value.net_Sat Apr 6 11:41:03 EST 2002.msg < prev    next >
Text File  |  2020-01-01  |  3KB  |  76 lines

  1. Article: 13296 of comp.protocols.kermit.misc
  2. Path: newsmaster.cc.columbia.edu!panix!news-xfer.newsread.com!bad-news.newsread.com!netaxs.com!newsread.com!news.maxwell.syr.edu!newsfeed1.cidera.com!Cidera!bcandid.telisphere.com!not-for-mail
  3. Message-ID: <3CAE6AD5.F70DD5C8@value.net>
  4. From: Mark Sapiro <msapiro@value.net>
  5. Organization: Not Very Much
  6. X-Mailer: Mozilla 4.79 [en] (Windows NT 5.0; U)
  7. X-Accept-Language: en,en-US,en-GB
  8. MIME-Version: 1.0
  9. Newsgroups: comp.protocols.kermit.misc
  10. Subject: Re: How to get return code from external Unix box running simple shell 
  11.  script?
  12. References: <d6e12cad.0204051329.574003a2@posting.google.com>
  13. Content-Type: text/plain; charset=us-ascii
  14. Content-Transfer-Encoding: 7bit
  15. Lines: 53
  16. Date: Sat, 06 Apr 2002 03:16:08 GMT
  17. NNTP-Posting-Host: 209.182.169.133
  18. X-Complaints-To: abuse@telisphere.com
  19. X-Trace: bcandid.telisphere.com 1018062968 209.182.169.133 (Fri, 05 Apr 2002 19:16:08 PST)
  20. NNTP-Posting-Date: Fri, 05 Apr 2002 19:16:08 PST
  21. Xref: newsmaster.cc.columbia.edu comp.protocols.kermit.misc:13296
  22.  
  23. Entfred wrote:
  24. > 1. Kermit script (on a Windows 2000 PC) telnets to an external Sun
  25. > Unix box.  The Kermit script is in a file called test.ksc:
  26. > set term type at386
  27. > set network tcp/ip
  28. > set host test.machine.com
  29. > output \13
  30. > input 5 login:
  31. > output testuser\13
  32. > input 5 password:
  33. > output testpassword\13
  34. > input 5 $
  35. > output testscript\13
  36. > connect
  37.  
  38. You can't connect.  Connect mode suspends your script until the mode is
  39. exited by the user.  You almost never want to connect in a script unless
  40. it's maybe the last thing in a login type script.
  41.  
  42. > if fail (I am not sure what do do right here to get Unix return code)
  43. > Exit
  44. > End ;
  45. > 2. On the Unix box, a simple script is run:
  46. > (call the script, testscript)
  47. > echo This is a test
  48. > date
  49. > exit 9
  50. > 3. I would like the result code of 9 to be sent back to the kermit
  51. > script residing on the Windows 2000 PC.
  52. > How would this be done?  Any tips to doing this would be
  53. > appreciated!
  54.  
  55. You could try something like the following:
  56.  
  57. {login stuff}
  58. output kermit -x\13    ; start remote kermit server
  59. input 5 {READY TO SERVE...}
  60. if failure ...
  61. remote host testscript    ; run testscript via remote kermit
  62. remote query kermit pexitstat    ; query the exit status
  63. ;  at this point \v(query) contains the return code from testscript
  64. finish    ; terminate the remote server
  65. ;  test \v(query) and proceed accordingly
  66.  
  67. -- 
  68. Mark Sapiro <msapiro@value.net>       The highway is for gamblers,
  69. San Francisco Bay Area, California    better use your sense - B. Dylan
  70.